home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / others / ole_101.zip / PATRON.ZIP / PATRON.H < prev    next >
C/C++ Source or Header  |  1992-04-13  |  6KB  |  189 lines

  1. /*
  2.  * PATRON.H
  3.  *
  4.  * Definitions and function prototypes for Patron.  OLE only affects
  5.  * a few minor parts of this file which are marked with a comments like
  6.  * "//OLE"
  7.  *
  8.  * Copyright(c) Microsoft Corp. 1992 All Rights Reserved
  9.  */
  10.  
  11. //Resource identifiers.
  12. #define IDR_MENU                1
  13. #define IDR_ACCELERATORS        1
  14. #define IDD_ABOUT               1
  15. #define ID_NULL                 -1      //Static controls
  16.  
  17.  
  18. //Menu command identifiers.
  19. #define IDM_FILENEW             100
  20. #define IDM_FILEOPEN            101
  21. #define IDM_FILESAVE            102
  22. #define IDM_FILESAVEAS          103
  23. #define IDM_FILEEXIT            104
  24.  
  25. #define IDM_EDITCUT             200
  26. #define IDM_EDITCOPY            201
  27. #define IDM_EDITPASTE           202
  28. #define IDM_EDITPASTELINK       203   //OLE
  29. #define IDM_EDITLINKS           204   //OLE
  30. #define IDM_EDITINSERTOBJECT    205   //OLE
  31. #define IDM_EDITCONVERTTOSTATIC 206   //OLE
  32. #define IDM_EDITCLEAR           207
  33. #define IDM_EDITCLEARALL        208
  34.  
  35.  
  36. #define IVERBMENU                12   //OLE: Menu position of the 'Object' item.
  37. #define IDM_EDITVERBMIN         250   //OLE: Values IDM_EDITVERBMIN+n specify a
  38. #define IDM_EDITVERBMAX         299   //OLE: verb from 0-n was selected
  39.  
  40. #define IDM_HELPABOUT           400
  41.  
  42.  
  43.  
  44. //String ID values.  Keep in SEQUENTIAL order and use 0-n
  45. #define IDS_FIRST               0
  46. #define IDS_CAPTION             IDS_FIRST+0
  47. #define IDS_CLASSPATRON         IDS_FIRST+1
  48. #define IDS_CLASSBLACKBOX       IDS_FIRST+2
  49. #define IDS_FILEDIRTY           IDS_FIRST+3
  50. #define IDS_DEFEXT              IDS_FIRST+4
  51. #define IDS_FILEOPENFILTER      IDS_FIRST+5
  52. #define IDS_FILEOPEN            IDS_FIRST+6
  53. #define IDS_FILESAVEAS          IDS_FIRST+7
  54. #define IDS_UNTITLED            IDS_FIRST+8
  55. #define IDS_LAST                IDS_FIRST+9
  56.  
  57.  
  58. /*
  59.  * CSTRINGS is number of strings to load from the stringtable.
  60.  * CCHSTRINGMAX is the maximum length that any string is allowed.
  61.  */
  62.  
  63. #define CSTRINGS                (IDS_LAST-IDS_FIRST)
  64. #define CCHSTRINGMAX            80
  65.  
  66.  
  67.  
  68. /*
  69.  * Structure holding the "global" variables.  Creating a structure with
  70.  * has several advantages over separately declaring each field as a
  71.  * global:
  72.  *  1.  Keep source files clean.
  73.  *  2.  Eliminates need for many "extern" declarations.
  74.  *  3.  A single pointer to this structure can be passed throughout
  75.  *      the application, hiding the fact that it's global.
  76.  *  4.  Allows the variables to be allocated dynamically or from
  77.  *      different memory than the application's stack.
  78.  *  5.  Any reference to these variables will have a pointer or
  79.  *      structure dereference, which points to where the variable
  80.  *      actually is defined.  Separate globals are not distinguishable
  81.  *      from locals, making code harder to read.
  82.  */
  83.  
  84. typedef struct
  85.     {
  86.     HWND        hWnd;               //Top-level application window.
  87.     HANDLE      hInst;              //Application instance handle.
  88.     LPSTR       pszCmdLine;         //Command line passed to WinMain.
  89.     HANDLE      hMemStrings;        //Stringtable memory.
  90.     HANDLE      hAccel;             //Application accelerators.
  91.     BOOL        fDirty;             //Is file dirty?
  92.     BOOL        fOpenFile;          //FALSE if File/New used until saved.
  93.     char        szFile[CCHPATHMAX]; //Filename for Save command.
  94.     HWND        hWndLastActive;     //Handle to most recently active BlackBox
  95.     } GLOBALS;
  96.  
  97. typedef GLOBALS FAR * LPGLOBALS;
  98.  
  99.  
  100. //External:
  101. extern char NEAR *rgpsz[CSTRINGS];
  102. extern LPGLOBALS pGlob;
  103. extern LPDOCUMENT  pDoc;  //OLE:  Our handle into the OLE world.
  104.  
  105.  
  106. //Versioning.
  107. #define VERSIONMAJOR            1
  108. #define VERSIONMINOR            0
  109.  
  110.  
  111.  
  112. /*
  113.  * PATRON is the file header structure.  Files are an array of FILEOBJECT
  114.  * structures defined in BLACKBOX.H.
  115.  *
  116.  * Any OLE data is stored after it with OleSaveToStream.
  117.  */
  118.  
  119. typedef struct
  120.     {
  121.     WORD        wVerMajor;      //Version number
  122.     WORD        wVerMinor;
  123.     RECT        rc;             //Rectangle
  124.     DWORD       dwState;        //Initial state
  125.     DWORD       cObjects;       //Number of FILEOBJECT structures.
  126.     } PATRON;
  127.  
  128. typedef PATRON FAR *LPPATRON;
  129. #define CBPATRON sizeof(PATRON)
  130.  
  131.  
  132.  
  133. /*
  134.  * Function prototypes, organized by source file.  Any small definition
  135.  * required by only one source file is also included here under the
  136.  * same heading.
  137.  */
  138.  
  139. //CLIP.C
  140. void     FAR PASCAL MenuClipboardEnable(HMENU, LPGLOBALS);
  141. BOOL     FAR PASCAL FEditCut(LPGLOBALS);
  142. BOOL     FAR PASCAL FEditCopy(LPGLOBALS, BOOL);
  143. BOOL     FAR PASCAL FEditPaste(LPGLOBALS, BOOL, LPDOCUMENT);
  144. BOOL     FAR PASCAL FEditConvertToStatic(LPGLOBALS, LPDOCUMENT);
  145.  
  146.  
  147. //INSDROP.C
  148. BOOL     FAR PASCAL FEditInsertObject(HWND, HANDLE, LPDOCUMENT);
  149. BOOL     FAR PASCAL FCreateFromDropFiles(HWND, HANDLE, LPDOCUMENT);
  150.  
  151.  
  152. //EXIT.C
  153. BOOL     FAR PASCAL FApplicationExit(LPGLOBALS);
  154.  
  155.  
  156. //FILE.C
  157. void     FAR PASCAL WindowTitleSet(LPGLOBALS);
  158. BOOL     FAR PASCAL FDirtySet(BOOL);
  159. BOOL     FAR PASCAL FCleanVerify(LPGLOBALS, LPDOCUMENT);
  160. BOOL     FAR PASCAL FFileNew(LPGLOBALS, LPDOCUMENT);
  161. BOOL     FAR PASCAL FFileOpen(LPGLOBALS, LPDOCUMENT, BOOL);
  162. BOOL     FAR PASCAL FFileSave(LPGLOBALS, LPDOCUMENT, BOOL);
  163. BOOL     FAR PASCAL FFileSaveAs(LPGLOBALS, LPDOCUMENT);
  164. BOOL     FAR PASCAL FFileExit(LPGLOBALS, LPDOCUMENT);
  165. BOOL     FAR PASCAL FFileClose(LPGLOBALS, LPDOCUMENT);
  166. BOOL     FAR PASCAL FEnumClose(LPDOCUMENT, LPOBJECT, DWORD);
  167.  
  168.  
  169. //FILEIO.C
  170. BOOL     FAR PASCAL FPtnFileRead(LPSTR, LPPATRON, HWND, LPDOCUMENT);
  171. BOOL     FAR PASCAL FPtnFileWrite(LPSTR, LPPATRON, LPDOCUMENT);
  172. BOOL     FAR PASCAL FEnumFileWrite(LPDOCUMENT, LPOBJECT, DWORD);
  173.  
  174.  
  175. //INIT.C
  176. BOOL     FAR PASCAL FApplicationInit(LPGLOBALS, HANDLE);
  177. BOOL     FAR PASCAL FClassRegister(LPGLOBALS, HANDLE);
  178. HWND     FAR PASCAL HPolylineWindowCreate(HWND, HANDLE);
  179. HANDLE   FAR PASCAL HLoadAppStrings(HANDLE);
  180.  
  181.  
  182. //PATRON.C
  183. BOOL     FAR PASCAL FMessageProcess(LPMSG);
  184. LONG     FAR PASCAL PatronWndProc(HWND, UINT, UINT, LONG);
  185. BOOL     FAR PASCAL FEnumClearAll(LPDOCUMENT, LPOBJECT, DWORD);
  186. void     FAR PASCAL WindowDelete(HWND, HWND);
  187. BOOL     FAR PASCAL AboutProc(HWND, UINT, UINT, LONG);
  188. int      FAR PASCAL ClientCallback(LPOBJECT, OLE_NOTIFICATION, LPOLEOBJECT);
  189.